home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-05-04 | 2.6 KB | 93 lines | [TEXT/GEOL] |
- Item forwarded by LOOMIS to GUITTET1
-
- Item forwarded by LOOMIS to COWSAR1 PLUMMER1 REKIETA1
-
- Item 8743492 30-April-90 00:43PDT
-
- From: AUST0334 AUDev - CRIA, Canberra, ACT,IDV
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: RE>Bug- non-unique fIdent
-
- RE>RE>Bug: non-unique fIdent
-
- Jesse,
-
- (I didn't see your original link, just James Plamodon's reply)
-
- Here is code that should provide Breadth First Searching of the view hierarchy,
- which should be fairly easy to install to your reqiuirements. (I haven't tested
- it, but the theory should be sound even if bits of the code are dubious.)
-
- FUNCTION TView.FindSubView (itsIdentifier: IDType): TView;
-
- VAR
- i: integer;
- StillSomeSubViews: BOOLEAN;
- theAnswer: TView;
-
- { finds the sub view matching the identifier at the given level }
- FUNCTION BreadthFindSubView (level: integer; theView: TView): TView;
- VAR
- theReturnedView: TView; { the view that has been found }
- PROCEDURE CallBreadthFindSubView (theSubView: TView);
- BEGIN
- IF theReturnedView = NIL THEN { find the first one }
- theReturnedView := BreadthFindSubView(level - 1, theSubView);
- END;
-
- BEGIN
- theReturnedView := NIL;
- IF level = 0 THEN {the level to search is this level }
- BEGIN
- IF LONGINT(theView.fIdentifier) = LONGINT(itsIdentifier) THEN
- theReturnedView := theView {! found the view }
- ELSE
- BEGIN { this is not the view }
- IF fsubView <> NIL THEN
- StillSomeSubViews := TRUE; { necessary to determine failure to find the
- view }
- END
- END
- ELSE
- BEGIN { search at a lower level than this one }
- EachSubView(CallBreadthFindSubView);
- END;
- BreadthFindSubView := theReturnedView;
- END;
-
- BEGIN{FindSubView }
- i := 0;
- theAnswer := NIL;
- REPEAT
- StillSomeSubViews := FALSE;
- theAnswer := BreadthFindSubView(i, SELF);
- i := i + 1;
- UNTIL (theAnswer <> NIL) OR (NOT stillSomeSubViews)
- FindSubView := theAnswer;
- END;
-
-
- A Minor Flame:
- As always, be cautious of bold assertions that something cannot be done in
- software. It harmeth not to admit that one does not know, or hasn't been able
- to get it to work. Stating unequivocally that something cannot be done may have
- a "chilling effect" on others, who might otherwise be willing to think about
- the problem a bit longer.
-
- Flame Diminished:
- Re: "C is the AntiChrist"... a message posted recently on AppleLink:
- I believe Pascal is excellent for teaching, but hopeless as a language to write
- programs in. (Though Inside MacApp should still use it as the example
- language).
-
- "Modula-2 rules OK!"
-
- Kenneth Beaton
- Canberra
- AUSTRALIA
-
-
-
-